# Copyright 1999-2008 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $

inherit toolchain-funcs games

DESCRIPTION="An SDL NetWalk clone"
HOMEPAGE="http://code.google.com/p/netwalk/"
SRC_URI="http://netwalk.googlecode.com/files/${P}.tgz"

LICENSE="GPL-2"
SLOT="0"
KEYWORDS="~x86 ~amd64"
IUSE=""

DEPEND="media-libs/libsdl
	media-libs/sdl-ttf"

src_unpack() {
	unpack ${A}
	cd "${S}"

	sed -i \
		-e "s:echo '#define NETWALK_SHARE_DIR \"'.*:echo '#define NETWALK_SHARE_DIR \"${GAMES_DATADIR}/${PN}\"' > sharedir.h:" \
		Makefile \
		|| die "sed Makefile failed"
}

src_compile() {
	emake \
		CC="$(tc-getCC)" \
		CFLAGS="${CFLAGS} `sdl-config --cflags`" \
		|| die "emake failed"
}

src_install() {
	dogamesbin netwalk || die "dogamesbin failed"
	insinto "${GAMES_DATADIR}/${PN}"
	doins Vera.ttf || die "doins failed"
	dodoc NEWS README
	prepgamesdirs
}
